import request from '@utils/request'

// 获取列表
const getAllCangkuList = async (data) => {
  return request({
    url: '/cangku/GetAllCangkuList',
    method: 'get',
    data
  })
}

// 获取权限列表
const getMyCangkuList = async (data) => {
  return request({
    url: '/server/GetMyCangkuList',
    method: 'get',
    data
  })
}

// 添加
const addCangku = async (data) => {
  return request({
    url: '/cangku/AddCangku',
    method: 'post',
    data
  })
}

// 编辑
const editCangku = async (data) => {
  return request({
    url: '/cangku/EditCangku',
    method: 'post',
    data
  })
}

// 删除
const deleteCangku = async (data) => {
  return request({
    url: '/cangku/DeleteCangku',
    method: 'get',
    data
  })
}

// 修改为默认
const updateCangkuMoren = async (data) => {
  return request({
    url: '/cangku/UpdateCangkuMoren',
    method: 'get',
    data
  })
}

// 添加充值记录
const createCangkuChongzhi = async (data) => {
  return request({
    url: '/server/CreateCangkuChongzhi',
    method: 'post',
    data
  })
}

// 获取充值记录
const getCangkuChongzhi = async (data) => {
  return request({
    url: '/server/GetCangkuChongzhi',
    method: 'get',
    data
  })
}

// 删除充值记录
const deleteCangkuChongzhi = async (data) => {
  return request({
    url: '/server/DeleteCangkuChongzhi',
    method: 'get',
    data
  })
}

// 仓库金额统计
const getCangkuTongji = async (data) => {
  return request({
    url: '/server/GetCangkuTongji',
    method: 'get',
    data
  })
}

// 设置代理的省份
const updateShengcangku = async (data) => {
  return request({
    url: `/cangku/UpdateShengcangku?id=${data.id}&cangkuid=${data.cangkuid}`,
    method: 'get',
    data: {}
  })
}


export {
  getAllCangkuList,
  getMyCangkuList,
  addCangku,
  editCangku,
  deleteCangku,
  updateCangkuMoren,
  createCangkuChongzhi,
  getCangkuChongzhi,
  deleteCangkuChongzhi,
  getCangkuTongji,
  updateShengcangku
}
